package experimentation

import javax.swing.text.html.HTML;


class HomeController {
	
    def index() {
		
		 }
	
	def home() {
		def uName = "test"
		String myMessage = ""

		if(session.user)
		{
			params.myMessage =  WelcomeMessage()
			params.Login = "Welcome, <a href=\"../User/account\">${session.user.userName}</a>  [<a href=\"../User/Logout\">Logout</a>]"
		}
		else
		{
			params.myMessage =  WelcomeMessage()
			params.Login = "Welcome, Guest.  [<a href=\"../User/login\">Login</a>][<a href=\"../User/register\">Register</a>]"
		}
		
	}
	
	def WelcomeMessage() { 
		String txt = "Welcome to the homepage, "
		if(session.user)
		{
			txt += "${session.user.userName}.";
		}
		else
		{
			txt+= "Guest"
		}
	}
	
	def Forum(){
		if(session.user)
		{
			params.myMessage =  WelcomeMessage()
			params.Login = "Welcome, <a href=\"../User/account\">${session.user.userName}</a>  [<a href=\"../User/Logout\">Logout</a>]"
		}
		else
		{
			params.myMessage =  WelcomeMessage()
			params.Login = "Welcome, Guest.  [<a href=\"../User/login\">Login</a>]"
		}
	}
	
}
